import Taro from '@tarojs/taro'
import config from '../constants/api'
import { get } from '../tool/request'

export const setPosition = (text, i) => {
    return { type: 'click' , name: text, index: i}
}
export const getAreaList = (params) => {
    return async dispatch => {
        Taro.showLoading()
        let list = await get(config.optionArea, params)
        dispatch({ type: 'getAreaList', list: list.data.data.list })
    }
}
export const getMoneyList = (params) => {
    return async dispatch => {
        let list = await get(config.optionMoney, params)
        dispatch({ type: 'getMoneyList', list: list.data.data.list })
    }
}
export const getMoreList = (params) => {
    return async dispatch => {
        let list = await get(config.optionMore, params)
        dispatch({ type: 'getMoreList', list: list.data.data.list })
    }
}
export const clickArea = (params) => {
    return { type: 'clickArea',   optionList: params}
}
export const clickMoney = (params) => {
    return { type: 'clickMoney',   optionList: params}
}
export default {
    setPosition,
    getAreaList,
    getMoreList,
    clickMoney
}